from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import JsonResponse


class LoginRequiredJSONMixin(LoginRequiredMixin):

    def handle_no_permission(self):
        # 如果没有登录 返回的是jsonResponse --父类 返回HttpResponse()
        return JsonResponse({'code':4000, 'errmsg':'未登录!'})
